package cate.game.pvp.gradepvp.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBGradePvp;

@ClientMsg(title = "我的全服段位赛数据 请求")
public class GradePvpDataReq implements MsgInput {
    @Override
    public void execute(GameBody game, ClientContext cc) {
        cc.getRole().getPvp().gradePvp.checkOpen();
        if (!cc.getRole().getPvp().gradePvp.isOpen()) {
            game.notice.message(cc.getRole(), "功能未开启");
            return;
        }
        // 检测过期匹配数据，并开始战斗
        cc.getRole().getPvp().gradePvp.checkMatchAndStart();
        GradePvpDataResp resp = new GradePvpDataResp(cc.getRole().getPvp().gradePvp);
        cc.sendNow(resp);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBGradePvp.DATA_REQ;
    }
}
